import React from 'react';
import {Tree} from 'antd';

const {TreeNode} = Tree;

export default class Demo extends React.Component {
  onSelect = (selectedKeys, info) => {
    console.log('selected', selectedKeys, info);
  };

  onCheck = (checkedKeys, info) => {
    console.log('onCheck', checkedKeys, info);
  };

  render() {
    return (
      <Tree
        checkable
        defaultExpandedKeys={['1-1', '2-1']}
        defaultSelectedKeys={['1-1']}
        defaultCheckedKeys={['3-3']}
        onSelect={this.onSelect}
        onCheck={this.onCheck}
      >
        <TreeNode title="一级" key="1-1">
          <TreeNode title="二级" key="2-1" disabled>
            <TreeNode title="三级" key="3-1" disableCheckbox/>
            <TreeNode title="三级" key="3-2"/>
          </TreeNode>

          <TreeNode title="二级" key="2-2">
            <TreeNode title={<span style={{color: '#1890ff'}}>三级</span>} key="3-3"/>
          </TreeNode>
        </TreeNode>
      </Tree>
    );
  }
}
